package com.lijin.controller

import com.lijin.entity.UserInfo
import com.lijin.service.IUserService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*

/**
 * Created by gold-jx on 2017/11/21.
 */
@RestController
@RequestMapping("/user")
class UserController {

    @Autowired
    lateinit  var userService:IUserService;

    @GetMapping("/{userId}/id")
    fun queryUserById(@PathVariable userId:String):List<UserInfo> {
        var userInfo=UserInfo(userId =userId.toLong(),username = null,password = null )

        var userList=userService.queryUserInfo(userInfo);
        return userList;
    }


    @PostMapping("/add")
    fun insertUser(username:String?,password:String?):Int{

        var userInfo=UserInfo(userId = null,username = username,password =password,deleted = 0);

        return userService.insertUser(userInfo);

    }
}